var navigato = "getComputedStyle" in window;//true就是在标准浏览器下
console.log(navigato); 
var box = document.getElementById('box');

console.log(getCss(box,'left'));

function getCss(attr){
    //在标准浏览器下
    if(navigato){
        return window.getComputedStyle(this,null)[attr];
    }else{//在ie678下
        if(attr === 'opacity'){
            var opacity = this.currentStyle['filter'];
            console.log(opacity);
            var reg = /^alpha\(opacity=(\d+(?:\.\d+)?)\)$/;
            console.log(reg.exec(opacity));

            return parseFloat(reg.exec(opacity)[1]/100);
        }else{
            return this.currentStyle[attr];
        }

        
        
    }
}

function setCss(attr,value){
    if(attr === "float"){
        this["style"]["cssFloat"] = value;
        this["style"]["styleFloat"] = value;
        return;
    }
    if(attr === "opacity"){
        this["style"]["opacity"] = value;
        this["style"]["filter"] = "alpha(opacity=" + value*100 +")";
        return;
    }

    var reg = /^(width|height|top|bottom|left|right|((margin|padding)(Top|Bottom|Left|Right)?))$/;
    if(reg.test(attr)){
        if(!isNaN(value)){
            value += "px";
        }
    }
    this["style"][attr] = value;

}

function setGroupCss(options){
    for(var key in options){
        if(options.hasOwnProperty(key)){
            setCss.call(this,key,options[key]);
        }
    }
}